/*
 * Copyright 2009 Original Author(s)
 * 
 * This file is part of Kommando
 * 
 * Kommando is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Kommando is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Kommando.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.kommando.shelf;

import javax.swing.Icon;

import org.kommando.core.Displayable;
import org.kommando.core.catalog.Catalog;
import org.kommando.core.catalog.CatalogObject;
import org.kommando.core.util.Assert;

/**
 * {@link ShelfEntry} represents an entry in the {@link Shelf}.
 * <p>
 * A {@link ShelfEntry} is a shallow copy of a {@link CatalogObject}, meaning
 * only its display attributes (icon, name and description) and its id attribute
 * are retained. This is done so that volatile {@link CatalogObject}s can also
 * be added to the {@link Shelf}.
 * <p>
 * Example: The user adds an object representing a mounted disk to the shelf. If
 * the disk is unmounted, it's no longer available, but it stays on the shelf.
 * When the user tries to use the object, the real {@link CatalogObject} will be
 * searched in the {@link Catalog} using the id.
 * 
 * @author Peter De Bruycker
 */
public class ShelfEntry implements Displayable {

	private static final long serialVersionUID = 1L;

	private String id;
	private String name;
	private String description;
	private Icon icon;

	public ShelfEntry(CatalogObject object) {
		Assert.argumentNotNull("object", object);
		
		this.id = object.getId();
		this.name = object.getName();
		this.description = object.getDescription();
		this.icon = object.getIcon();
	}

	public ShelfEntry() {

	}

	public String getId() {
		return id;
	}

	@Override
	public String getDescription() {
		return description;
	}

	@Override
	public Icon getIcon() {
		return icon;
	}

	@Override
	public String getName() {
		return name;
	}
	
}
